<?php
	require('function.php');
	session_start();
	$old_user = $_SESSION['valid_user'];
	unset($_SESSION['valid_user']);
	$result_destroy = session_destroy();
	if(!empty($old_user)){
		if ($result_destroy){
			echo "$old_user has logged out.<br />";
			display_login();
			}
		else{
			echo 'Sorry,operation "Logged out" is failed!Please try again.';
			}
	}
	else{
		echo 'You were not logged in';
		display_login();
	}
?>